package cn.lucky.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author lingpeng.jiang
 * @create 2021-01-27-21:23
 */
@RestController
public class NacosConsumerController {


    @Value("${service.provider-url}")
    private String SERVER_URL;


    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/comsumer/nacos")
    public String getServerPort(){
        return restTemplate.getForObject(SERVER_URL + "/nacos/provider/port", String.class);
    }

}
